<div class="zhongchengyao">
  <div class="search">
    <h1 class="afterClean">
      <img src="/assets/main/basic-database/bg28.jpg" />
      <!-- <button>批量打回</button> -->
    </h1>
    <div class="searchBox afterClean">
      <ul class="afterClean">
        <li>
          <label>药物名称：</label>
          <input nv-input type="text" [(ngModel)]="drugName">
        </li>
        <li>
          <label>用法：</label>
          <input nv-input type="text" [(ngModel)]="method">
        </li>
        <li>
          <label>类型：</label>
          <input nv-input type="text" [(ngModel)]="type">
        </li>
      </ul>
      <button class="searchBtn" (click)="search()"></button>
    </div>

  </div>
  <div class="content">
    <div class="tableWrap">
      <!-- <button class='deleteAll' *ngIf="indeterminate||allChecked" (click)="deleteAll()"></button> -->
      <nv-table #messagesTable [nvData]="messages" [nvFrontPagination]="false" [nvLoading]="false" [nvNoResult]="noResult"
        (nvCurrentPageDataChange)="messageChanged($event)" [nvShowPagination]="false" [nvFooter]="tableFooterTemplate">
        <thead *ngIf="messages&&messages.length>0">
          <tr>
            <!-- <th nvShowCheckbox [(nvChecked)]="allChecked" [nvIndeterminate]="indeterminate"
                        (nvCheckedChange)="checkAll($event)">序号</th> -->
            <th>序号</th>
            <th>药名</th>
            <th>用法</th>
            <th>类型</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody #messagesBody>
          <tr *ngFor="let message of messagesTable.data;let i = index;" #messagesTr>
            <td nvShowCheckbox [(nvChecked)]="message.checked" [nvDisabled]="message.disabled" (nvCheckedChange)="refreshStatus($event)">
              {{(currentPage-1)*20+i+1}}
            </td>
            <td>{{message['药名']}}</td>
            <td>{{message['用法']}}</td>
            <td>
              <span *ngIf="message['类型1']">{{message['类型1']}},</span>
              <span *ngIf="message['类型2']">{{message['类型2']}},</span>
              <span *ngIf="message['类型3']">{{message['类型3']}}</span>
            </td>
            <td><button (click)="goToDetail(message['_id'])">查看</button></td>
          </tr>
        </tbody>
      </nv-table>
      <ng-template #noResult>
        <h2 class="noResult">暂无数据</h2>
      </ng-template>
      <ng-template #tableFooterTemplate class="tableFooterPart">
        <div *ngIf="messagesTable.data.length>0" class="pagination">
          <button class="backToFirstBtn" (click)="currentPage=1;getList();">首页</button>
          <button class="beforePage" (click)="goToBeforePage()">上一页</button>
          <button class="nextPage" (click)="goToNextPage()">下一页</button>
          <button class="backToLastBtn" (click)="currentPage=total_pages;getList();">尾页</button>
          <!-- <nv-pagination [nvTotal]="total_results" [(nvPageIndex)]="currentPage" (nvPageIndexChange)="getList()"></nv-pagination> -->
          <span class="totalText">页次：<i class="currentPage">{{currentPage}}</i>/<i class="totalPages">{{total_pages}}</i>页</span>
          <span class="totalResults">共<i>{{total_results}}</i>条记录</span>
          <span class="perPage"><i>20</i>条记录/页</span>
          <span>转到：</span>
          <nv-input-group class="pageJumpInputGroup">
            <input type="number" nv-input min="1" max="{{total_pages}}" [(ngModel)]="targetPage" (keydown.enter)="JumpToTargetPage()">
          </nv-input-group>
          <button class="pageJumpConfirmBtn" (click)="JumpToTargetPage()">Goto</button>
        </div>
      </ng-template>
    </div>
  </div>
  <div class="footer">
    上海市中医文献馆版权所有
  </div>
</div>
